package com.example.nio02;

import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        System.out.println("hello");
        P a = new P(2, "a");
        P b = new P(null, "b");
        P c = new P(1, "c");
        List<P> list = new ArrayList<>();
        list.add(a);
        list.add(b);
        list.add(c);
        list.sort(Comparator.comparingInt(p -> p.order));
        System.out.println(list);

    }

    static class P {
        private Integer order;
        private String name;

        public P(Integer order, String name) {
            this.order = order;
            this.name = name;
        }

        @Override
        public String toString() {
            return "P{" + "order=" + order + ", name='" + name + '\'' + '}';
        }
    }
}



